<!DOCTYPE html>
<html lang="zh"xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>首页 - 天才(genius)后台管理系统</title>
    <link rel="icon" th:href="@{favicon.ico}" type="image/ico">
    <link href="css/bootstrap.min.css" th:href="@{~/css/bootstrap.min.css}" rel="stylesheet">
    <link href="css/materialdesignicons.min.css" th:href="@{~/css/materialdesignicons.min.css}" rel="stylesheet">
    <link href="css/style.min.css" th:href="@{~/css/style.min.css}" rel="stylesheet">
    <!--标签插件-->
    <link rel="stylesheet" th:href="@{~/js/jquery-tags-input/jquery.tagsinput.min.css}" href="js/jquery-tags-input/jquery.tagsinput.min.css">
</head>

<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside th:include="left :: common" class="lyear-layout-sidebar">
        </aside>
        <!--End 左侧导航-->
        <!--头部信息-->
        <header th:include="head :: common" class="lyear-layout-header">
        </header>
        <!--End 头部信息-->

        <!--页面主要内容-->
        <main class="lyear-layout-content">
            <form action="/study-employee/empmodification" method="post" id="save_emp">
                <input type="hidden" th:value="${studyemp.id}" name="id">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="card">
                                <div class="card-body">
                                        <div class="form-group col-md-6">
                                            <label >修改人</label>
                                            <input type="hidden" name="empModifiedId" th:value="${session.USER.id}">
                                            <input type="text" disabled="disabled" class="form-control" th:value="${session.USER.empName}"/>
                                        </div>
                                    <div class="form-group col-md-6" >
                                        <label >员工名称</label>
                                        <input type="text" name="empName" onblur="save()" th:value="${studyemp.empName}" class="form-control"  id="empName"  placeholder="请输入角色名称" />
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label >角色</label>
                                        <div class="form-controls">
                                            <select name="empRoleId"  class="form-control" >
                                                <option th:each="role : ${rolelist}" th:selected="${studyemp.empRoleId==role.id}" th:value="${role.id}" >[[${role.roleName}]]</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label >员工状态</label>
                                        <div class="form-controls">
                                            <select name="empState"  class="form-control" >
                                                <option value="1"  th:selected="${studyemp.empState==1}">在职</option>
                                                <option value="2"  th:selected="${studyemp.empState==2}">离职</option>
                                                <option value="3"  th:selected="${studyemp.empState==3}">辞退</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label >部门</label>
                                        <div class="form-controls">
                                            <select name="empDepId"  class="form-control" >
                                                <option th:each="dep:${deplist}" th:selected="${studyemp.empDepId==dep.id}" th:value="${dep.id}">[[${dep.depName}]]</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group col-md-12 alert alert-danger" role="alert"  hidden="true" id="msg"></div>
                                    <div class="form-group col-md-8">
                                            <button type="button" class="btn btn-primary" id="svemp" data-toggle="modal" data-target=".bs-example-modal-sm">保存</button>

                                            <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
                                                <div class="modal-dialog modal-sm" role="document">
                                                    <div class="modal-content">
                                                        <div class="modal-header">
                                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                                                            <h4 class="modal-title" id="myLargeModalLabel">员工新增</h4>
                                                        </div>
                                                        <div class="modal-body">
                                                            是否确认添加😊
                                                        </div>
                                                        <div class="modal-footer">
                                                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                                            <button type="button" onclick="add()" class="btn btn-primary">点击保存</button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <button type='button' class='btn btn-default' onclick="javascript:history.back(-1);return false;">返 回</button>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </main>
    </div>
    <!--End 页面主要内容-->
</div>
</div>
<script type="text/javascript" th:src="@{~/js/jquery.min.js}" src="js/jquery.min.js"></script>
<script type="text/javascript" th:src="@{~/js/bootstrap.min.js}" src="js/bootstrap.min.js"></script>
<script type="text/javascript" th:src="@{~/js/perfect-scrollbar.min.js}" src="js/perfect-scrollbar.min.js"></script>
<script src="/js/jconfirm/jquery-confirm.min.js" th:src="@{~/js/jconfirm/jquery-confirm.min.js}"></script>
<script type="text/javascript" th:src="@{~/js/main.min.js}" src="js/main.min.js"></script>

<!--图表插件-->
<script type="text/javascript" th:src="@{~/js/Chart.js}" src="js/Chart.js"></script>
<script type="text/javascript">
    function save() {
        $("#svemp").attr({"disabled":"disabled"});
        var empName =$("#empName").val();
        if(empName==""||empName==undefined){
            $("#msg").html("请输入员工名称").show();
            setTimeout(function () {
                $("#msg").hide();
            }, 3000);
            return
        }
        $("#svemp").removeAttr("disabled");
    }
    function add() {
        $("#save_emp").submit();
    }
</script>
</body>
</html>